<%@page import="java.util.List"%>
<%@page import="com.jfinal.plugin.activerecord.Page"%>
<%@page import="com.hongye.model.AdminUser"%>
<%@page import="com.hongye.app.model.RoleModel"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false" pageEncoding="UTF-8"%>
 <% AdminUser admin = (AdminUser)request.getAttribute("adminUser"); %>
<!doctype html>
<html class="fixed">
	<head>
		<!-- Basic -->
		<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="keywords" content="HTML5 Admin Template" />
		<meta name="description" content="Porto Admin - Responsive HTML5 Template">
		<meta name="author" content="okler.net">
		<!-- Mobile Metas -->
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<!-- Vendor CSS -->
		<link rel="stylesheet" href="../admin/css/bootstrap.css" />
		<link rel="stylesheet" href="../admin/css/font-awesome/css/font-awesome.css" />
        <link rel="stylesheet" href="../admin/css/select2.css" />
		<!-- Theme CSS -->
		<link rel="stylesheet" href="../admin/css/theme.css" />
		<!-- Skin CSS -->
		<link rel="stylesheet" href="../admin/css/default.css" />
		<!-- Theme Custom CSS -->
		<!-- Theme Custom ../admin/css -->
		<script src="../admin/js/modernizr.js"></script>
	</head>
	<body>
		<section role="main" class="content-body" style="margin-top: 50px;">
			<!-- start: page -->
			<section class="panel">
				<header class="panel-heading">
					<h2 class="panel-title">平台用户-详情</h2>
				</header>
				<div class="panel-body">
					<div class="panel-body">
						<p class="lead"> <span class="alternative-font"><%=admin.get("username") %></span> </p>
						<p><li>用户姓名：<input type="text" id="username" name="username" value='<%=admin.get("username") %>' /></li></p>
						<p><li>
							角色名称：
							<select id="roleselect" style="width:150px;height:45px">
								<% List<RoleModel> rolelist=(List)request.getAttribute("rolelist");
									for(int i=1;i<=rolelist.size();i++){
										RoleModel role = rolelist.get(i-1);
								%>
					                   <option selected value='<%=role.get("id")%>'><%=role.get("r_name")%></option>
					            <%} %>
			               </select>
						</li></p>
						<p><li>创建日期：<%=admin.get("c_time") %></li></p>
						<p><li>登陆时间：<%=admin.get("l_time") %></li></p>
						<p><li>登陆ip：<%=admin.get("l_IP") %></li></p>
						<p><li>登陆次数：<%=admin.get("login_times") %></li></p>
						<p><li>登陆id：<%=admin.get("loginname") %></li></p>
						<p><li>用户姓名：<%=admin.get("username") %></li></p>
						<p><li>用户状态：<%int state = admin.getInt("status");if(state==0){out.println("正常");}else{out.println("被冻结");} %></li></p>
						<p>	<li>
							修改状态：
							<input type="radio" name="state" value="0" />解冻
							<input type="radio" name="state" value="1" />冻结
						</li></p>
						<div class="mb-xs text-center">
							<a class="btn btn-facebook mb-md ml-xs mr-xs" onclick="editAdmin()">确定提交 </a>
	                        <a class="btn btn-facebook mb-md ml-xs mr-xs" href="../admin/adminUserView" >取消</a>
						</div>
					</div>
				</div>
			</section>
		</section>
<!-- Specific Page Vendor -->
<!-- Vendor -->
<script src="../admin/js/jquery.js"></script>
<script src="../admin/js/layer.js"></script>
<!-- Theme Base, Components and Settings -->
<script src="../admin/js/theme.js"></script>
<!-- Theme Custom -->
<script src="../admin/js/theme.custom.js"></script>
<!-- Theme Initialization Files -->
<script src="../admin/js/theme.init.js"></script>
<!-- Examples -->
<script src="../admin/js/tables/examples.datatables.default.js"></script>
<script src="../admin/js/tables/examples.datatables.row.with.details.js"></script>
<script src="../admin/js/tables/examples.datatables.tabletools.js"></script>
<script type="text/javascript">
window.onload = function (){
	var rid = ${roleid};
    $("#roleselect").val(rid);
} 
// 修改平台用户
function editAdmin(){
	var id = ${id};
	var state = $('input[name="state"]:checked').val();
	var username = $("#username").val();
	var role_id = $("#roleselect").val();
	var url = '../admin/editAdmin?state='+state+'&id='+id+'&username='+username+'&role_id='+role_id;
	$.get(url,function(data){
		if(data=='suc'){
			layer.msg('修改成功！');
			location.href='../admin/adminUserView';
		}else{
			layer.msg('更新失败...', {icon: 5});
		}
	});
}
</script>
</body>

</html>